<?php
/**
 * Created by 系统设置类.
 * User: 尚金殿
 * Date: 2018/8/28
 * Time: 09:51
 */

namespace app\admin\controller;


use think\Db;

class SystemController extends CommonController
{
    protected $mysql = 'system';
    protected $pk = 'id';

    //系统设置
    public function lists(){
        $system = Db::name($this->mysql)->where($this->pk,1)->find();
        $this->assign('system',$system);
        return $this->fetch();
    }

    //编辑系统
    public function edit(){
        $id = $this->request->param('id');
        $data['one_member'] = $this->request->param('one_member');
        $data['two_member'] = $this->request->param('two_member');
        $data['about'] = $this->request->param('about');
        $data['tel'] = $this->request->param('tel');

        //入库编辑
        $res = Db::name($this->mysql)->where($this->pk,$id)->update($data);

        if(!$res){
            return show(0,'编辑失败');
        }
            return show(1,'编辑成功');
    }
}